<?php

/**
 * This is the model class for table "workflow_states".
 *
 * The followings are the available columns in table 'workflow_states':
 * @property integer $id
 * @property integer $workflow_id
 * @property string $name
 * @property string $human_name
 * @property integer $inform_descriptor_id
 * @property integer $manage_permissions
 * @property integer $manage_actions
 */
class Flujos extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Flujos the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'workflow_states';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('name, human_name', 'required'),
			array('workflow_id, inform_descriptor_id, manage_permissions, manage_actions', 'numerical', 'integerOnly'=>true),
			array('name', 'length', 'max'=>255),
			array('human_name', 'length', 'max'=>100),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, workflow_id, name, human_name, inform_descriptor_id, manage_permissions, manage_actions', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'workflow_id' => 'Workflow',
			'name' => 'Name',
			'human_name' => 'Human Name',
			'inform_descriptor_id' => 'Inform Descriptor',
			'manage_permissions' => 'Manage Permissions',
			'manage_actions' => 'Manage Actions',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('workflow_id',$this->workflow_id);
		$criteria->compare('name',$this->name,true);
		$criteria->compare('human_name',$this->human_name,true);
		$criteria->compare('inform_descriptor_id',$this->inform_descriptor_id);
		$criteria->compare('manage_permissions',$this->manage_permissions);
		$criteria->compare('manage_actions',$this->manage_actions);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}